<?php
phpinfo();

   $serverName = "mercoit.dyndns.org,1433";

   $database = "habilitaciones";



   // Get UID and PWD from application-specific files.

   $uid = "sa";

   $pwd = "Sa1234";



   try {

      $conn = new PDO("sqlsrv:server=$serverName;Database = $database", $uid, $pwd);

      $conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );

   }



   catch( PDOException $e ) {

      die( "Error connecting to SQL Server" . $e->xdebug_message );

   }



   echo "Connected to SQL Server\n";



   $query = 'select * from vehiculos';

   $stmt = $conn->query( $query );

   while ( $row = $stmt->fetch( PDO::FETCH_ASSOC ) ){

      print_r( $row );

   }



   // Free statement and connection resources.

   $stmt = null;

   $conn = null;

?>